<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateLogisticsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('logistics', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('no', 50)->comment('运单号码');
            $table->string('code', 20)->nullable()->comment('快递公司编码');
            $table->unsignedTinyInteger('delivery_status')->default(0)->comment('物流状态|["快递收件(揽件)","在途中","正在派件","已签收","派送失败（无法联系到收件人或客户要求择日派送，地址不详或手机号不清）","疑难件（收件人拒绝签收，地址有误或不能送达派送区域，收费等原因无法正常派送）","退件签收"]');
            $table->string('courier_phone', 25)->nullable()->comment('快递小哥电话');
            $table->json('response')->comment('响应内容');
            $table->unsignedBigInteger('frequency_num')->default(0)->comment('调用次数');
            $table->timestampsTz();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('logistics');
    }
}
